Support managed blue/green Flex Node agent upgrades - #266
Conversation
|
Temporarily reopening to retrigger the repository's native PR checks; keeping this PR in draft. |
|
Dependency update: the secure HTTPS/SHA-256/archive/blue-green installer was moved to Azure/unbounded#585. This PR now consumes Unbounded commit |
|
Self-review updates pushed in |
|
Final focused real-cluster E2E passed on the updated implementation: successful MachineOperation upgrade, host/nspawn digest equality, Node readiness, kubelet Lease renewal, forced candidate failure with automatic last-good rollback, sensitive URL status check, retry into the inactive slot, and workload smoke test. |
|
Updated the dependency to Unbounded |
|
Updated to Unbounded |
|
Updated to Unbounded |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 34 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
docs/usages/operations.md:80
- This preflight invocation also needs root privileges. The managed links live under
/usr/local/lib/aks-flex-node, whose directory is created with mode0750; a normal user cannot resolve the current/last-good links, so this documented command fails before producing a plan. The E2E correctly invokes preflight withsudo.
/var/tmp/aks-flex-node-candidate agent-upgrade --preflight
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 34 changed files in this pull request and generated no new comments.
Suppressed comments (2)
pkg/daemon/agent_upgrade.go:125
RecoveryRequiredis set even when no switch occurred. If staging fails before activation andAbortthen fails while inspecting or clearing the signal,beginAgentUpgradeRecoveryrecords this flag; startup recovery consequently restoresLastGoodPath, potentially downgrading a still-valid current binary after an earlier successful upgrade. Derive this flag fromSwitchCommitted/whether the candidate is active, and track a restart needed only for result publication separately.
signal.RecoveryRequired = true
pkg/daemon/agent_upgrade.go:334
- Mandatory: clearing the signal here is not crash-safe with the callers. The stage/restart/wait failure branches call
Abortand only afterward persist the terminal failure; because the operation is alreadyInProgress, a crash after this removal leaves no recovery signal, and the shared reconciler does not enqueueInProgressoperations. Split rollback from signal deletion and retain the signal until terminal status is durable, or let startup publish the failure.
return e.signals.clear()
# Conflicts: # pkg/daemon/daemon.go
# Conflicts: # cmd/aks-flex-node/main.go # go.mod # go.sum # hack/e2e/README.md # hack/e2e/run.sh
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 34 changed files in this pull request and generated no new comments.
Suppressed comments (1)
pkg/daemon/agent_upgrade.go:395
recordFailureunconditionally setsRecoveryRequired, so a systemd failure before the candidate is switched still forcesrollbackAgentUpgradeFilesto restorelast-good. After a prior successful upgrade,last-goodis the older slot; an unrelated crash duringRecordPending, status update, or download therefore downgrades a valid current binary even though the candidate was never active. Determine recovery necessity fromSwitchCommitted/whetherCurrentPathresolves toCandidatePath, while preserving an already-recorded recovery requirement, before invoking rollback.
if err := signals.recordFailure(message); err != nil {
return err
}
signal, err := signals.read()
if err != nil {
|
manual validate in test env, will merge it and validate in a separate PR |
Summary
AgentUpgradeMachineOperations in the Flex daemonagent-upgrade [--preflight]command for separately delivered candidatespkg/agent/agentbinaryAPIs for activation planning, candidate snapshots, locking, verification, switching, health checks, and rollbackversionverificationArchitecture
Flex supplies its own unexported daemon-service adapter for
aks-flex-node-agent.service. It reuses the existing Flex lifecycle assets,utilexec/utilio, persisted active-nspawn state, and recovery behavior rather than importing Unbounded command internals or copying Unbounded-specific unit assumptions.The dependency is pinned to merged Azure/unbounded#592 commit
b05575d6910044834722daaccffe6d4304e1f70a.install.shremains unchanged and owns only normal installation. E2E/provisioning rejoin logic detects an existing managed layout and invokes the separately uploaded candidate's Goagent-upgradecommand before bootstrap.Upgrade lifecycle
InProgress.Direct host activation privately snapshots the staged candidate, performs the same managed switch, and leaves an already inactive service stopped for reset/rejoin provisioning. MachineOperation and direct activation cannot overlap: the process lock protects staging/switching, and the durable signal protects the post-restart handoff window.
Security behavior
aks-flex-node-linux-amd64oraks-flex-node-linux-arm64).versioncommand before activation.Testing
make verify && make check && make build-allRun the focused scenario with:
Fixes #265